﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using DomainModel.Entities;
using Service.Abstract;

namespace WebUI.Controllers
{
    public class BaseController : Controller
    {
        public User CurrentUser 
        {
            get
            {
                var currentUserEmail = HttpContext.User.Identity.Name;
                return _userService.GetAllUser().Where(x => x.UserName == currentUserEmail).First();
            }
            set { }
        }

        private readonly IUserService _userService;

        public BaseController(IUserService userService)
        {
            _userService = userService;
        }
    }
}
